commit: [scan-build] Remove a dead assignment
authorColin Walters <walters@verbum.org>
Wed, 16 Oct 2019 13:38:29 +0000 (13:38 +0000)
committerColin Walters <walters@verbum.org>
Wed, 16 Oct 2019 13:38:29 +0000 (13:38 +0000)
The `write_commit()` API defaults to current time, and
this assignment became dead in:
https://github.com/ostreedev/ostree/commit/8ba90a33410c9707a30a77f808a7ec712d465165

src/ostree/ot-builtin-commit.c

index 43eb18b3f63b120b4f58798ee8924bd2d1743dd3..0eea09d75bc35f3f09fb65a0dc96e0c664d5a04d 100644 (file)
@@ -772,8 +772,6 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
 
   if (!skip_commit)
     {
-      guint64 timestamp;
-
       if (!opt_no_bindings)
         {
           g_autoptr(GVariant) old_metadata = g_steal_pointer (&metadata);
@@ -782,10 +780,6 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
 
       if (!opt_timestamp)
         {
-          GDateTime *now = g_date_time_new_now_utc ();
-          timestamp = g_date_time_to_unix (now);
-          g_date_time_unref (now);
-
           if (!ostree_repo_write_commit (repo, parent, opt_subject, commit_body, metadata,
                                          OSTREE_REPO_FILE (root),
                                          &commit_checksum, cancellable, error))
@@ -800,8 +794,8 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
                            "Could not parse '%s'", opt_timestamp);
               goto out;
             }
-          timestamp = ts.tv_sec;
 
+          guint64 timestamp = ts.tv_sec;
           if (!ostree_repo_write_commit_with_time (repo, parent, opt_subject, commit_body, metadata,
                                                    OSTREE_REPO_FILE (root),
                                                    timestamp,